<div class="ui_table">
    <table>
        <tr>
            <td>
                <div class="popup_btn" style="border-top:0px">
                    <button class="btn btn_border" onclick="addMarker(new Date())">今日轨迹</button>
                </div>
            </td>
            <td>
                <div class="popup_btn" style="border-top:0px">
                    <button class="btn btn_border" onclick="addMarker(new Date((new Date()).getTime()-24*60*60*1000))">
                        昨日轨迹
                    </button>
                </div>
            </td>
            <td>
                <input style="height: 32px" class="easyui-datebox"
                       data-options="onSelect:addMarker"></input>
            </td>
            <td>
                <select style="height: 32px;" editable="false" id="order_id"
                        onChange="orderAddMarker()">
                    <option value="">按订单查询</option>
                <#list orderList as order>
                    <option value="${order}">${order}</option>
                </#list>
                </select>
            </td>
            <td id="dynamic_btn">
                <div class="easyui-panel">
                    <a href="#" class="easyui-menubutton" data-options="menu:'#dynamic'">回放</a>
                </div>
                <div id="dynamic">
                    <div onclick="dynamicMarker($('#dynamic_btn'),0.5)">0.5倍回放</div>
                    <div onclick="dynamicMarker($('#dynamic_btn'),1)">1倍回放</div>
                    <div onclick="dynamicMarker($('#dynamic_btn'),2)">2倍回放</div>
                </div>
            </td>
        </tr>

    </table>
    <div style="width: 99%; height:650px; border:1px solid #ccc;margin:0 auto;">
        <iframe id="map_frame_${pid}" src="${contextPath}/security/basic/baidu_map/battery_location.htm?lng=${(lng)!''}&lat=${(lat)!''}"
                width="100%" height="100%" frameborder="0"></iframe>
    </div>
</div>
<script type="text/javascript">
    var list;
    <#-- 查询 -->
    function addMarker(date) {
        var mapFrame = document.getElementById('map_frame_${pid}');
        var queryTime = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate();
        $.post("${contextPath}/security/hdw/battery_report_log/location.htm?batteryId=${id}&createTime=" + queryTime, function (json) {
            var doc = mapFrame.contentDocument || mapFrame.document;
            var childWindow = mapFrame.contentWindow || mapFrame;
            childWindow.addMarker(json.data);
            if (json.data != null && json.data != '') {
                list = json.data;
                $("#dynamic_btn").show();
            } else {
                $("#dynamic_btn").hide();
            }
        }, 'json');
    }
    <#-- 根据订单查询坐标列表 -->
    function orderAddMarker() {
        orderId = $('#order_id').val();
        if (orderId != '') {
            var mapFrame = document.getElementById('map_frame_${pid}');
            $.post("${contextPath}/security/hdw/battery_report_log/location.htm?orderId=" + orderId, function (json) {
                var doc = mapFrame.contentDocument || mapFrame.document;
                var childWindow = mapFrame.contentWindow || mapFrame;
                childWindow.addMarker(json.data);
                if (json.data != null && json.data != '') {
                    list = json.data;
                    $("#dynamic_btn").show();
                } else {
                    $("#dynamic_btn").hide();
                }
            }, 'json');
        }
    }
    function dynamicMarker(td,s) {
        if(list==undefined){
            return false;
        }
        var mapFrame = document.getElementById('map_frame_${pid}');
        var doc = mapFrame.contentDocument || mapFrame.document;
        var childWindow = mapFrame.contentWindow || mapFrame;
        childWindow.dynamicMarker(list,td,s);
    }
</script>


